import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const {resolve} = require('path')
function pathResolve(dir: string) {
  return resolve(process.cwd(), '.', dir);
}
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: [
      {
        find: /@\//,
        replacement: pathResolve('src') + '/',
      },
    ],
  },
  server: {
    port:81,
    proxy: {
      '/api': {
        changeOrigin:true,
        target: "http://127.0.0.1:3900",
        rewrite: (path)=>{
          console.log(path);
          return  path.replace(/^\/api/, '/')
        }
      },
    },
    cors:true
  },
})
